package cn.itcas.statistics.controller;

import cn.itcas.statistics.domain.AlkalinityDosage;
import cn.itcas.statistics.domain.CODRemovalRate;
import cn.itcas.statistics.domain.DailyProfit;
import cn.itcas.statistics.domain.MedicamentConcentration;
import cn.itcas.statistics.service.Impl.StatisticsService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;
import java.util.Map;

import static com.ruoyi.common.core.web.domain.AjaxResult.success;

@RestController
@RequestMapping("/statistics")
public class StatisticsController {
    @Autowired
    private StatisticsService statisticsService;

    @GetMapping("/dailyprofit")
    public AjaxResult dailyProfit(Long projectId){
        List<DailyProfit> dailyProfitList = statisticsService.selectDailyProfitById(projectId);
        return success(dailyProfitList);
    }

    @GetMapping("/codremovalrate")
    public AjaxResult CODRemovalRate(Long processDataId){

        List<CODRemovalRate> codRemovalRateList = statisticsService.selectCODRemovalRateById(processDataId);
        return success(codRemovalRateList);
    }

    @GetMapping("/medicamentconcentration")
    public AjaxResult medicamentConcentration(Long projectId){
        List<MedicamentConcentration> medicamentConcentrationList = statisticsService.selectMedicamentById(projectId);
        return success(medicamentConcentrationList);
    }

    @GetMapping("/weekavgrate")
    public AjaxResult weekAvgRate(){
        Map<String,Float> weekCODRemovalRate = statisticsService.selectWeekAvgRate();
        return success(weekCODRemovalRate);
    }

    @GetMapping("/alkalinitydosage")
    public AjaxResult alkalinityDosage(Long projectId){
        List<AlkalinityDosage> alkalinityDosageList = statisticsService.selectAlkalinityDosageById(projectId);
        return success(alkalinityDosageList);
    }
}
